unit uMultipleChoice;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.CheckLst,
  Vcl.ExtCtrls, Vcl.Buttons;

type
  TfrmMultipleChoice = class(TForm)
    btnOk: TBitBtn;
    cb: TBitBtn;
    memDescription: TMemo;
    edtOption: TLabeledEdit;
    btnAdd: TBitBtn;
    btnRemove: TBitBtn;
    clbChoices: TCheckListBox;
    Panel1: TPanel;
    Panel2: TPanel;
    btnEdit: TBitBtn;
    Splitter1: TSplitter;
    btnClear: TBitBtn;
    procedure btnAddClick(Sender: TObject);
    procedure btnRemoveClick(Sender: TObject);
    procedure btnEditClick(Sender: TObject);
    procedure clbChoicesClick(Sender: TObject);
    procedure btnClearClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMultipleChoice: TfrmMultipleChoice;

implementation

{$R *.dfm}

procedure TfrmMultipleChoice.btnClearClick(Sender: TObject);
begin
  edtOption.Text := '';
end;

procedure TfrmMultipleChoice.btnAddClick(Sender: TObject);
begin
  clbChoices.Items.Add( edtOption.Text );
  edtOption.Text := '';
end;

procedure TfrmMultipleChoice.btnRemoveClick(Sender: TObject);
begin
  clbChoices.Items.Delete( clbChoices.ItemIndex );
end;

procedure TfrmMultipleChoice.btnEditClick(Sender: TObject);
begin
  if edtOption.Text = '' then
    edtOption.Text := clbChoices.Items[ clbChoices.ItemIndex ]
  else
    clbChoices.Items[ clbChoices.ItemIndex ] := edtOption.Text
end;

procedure TfrmMultipleChoice.clbChoicesClick(Sender: TObject);
var
  e: Boolean;
begin
  e := (clbChoices.ItemIndex >=0) and (clbChoices.ItemIndex < clbChoices.Items.Count);
  btnRemove.Enabled := e;
  btnEdit.Enabled := e;
end;

end.
